In [1]:
from itertools import product
for a, b, c, d in product(range(10), repeat=4):
N = 10203040596979899
N += a*10**15 + b*10**13 + c*10**11 + d*10**9
sqrtN = int(N**0.5)
s = str(sqrtN**2)
if s[0:17:2] == '123456789':
print(sqrtN * 10)
break
Explanation: Note that if a square is divisible by 10 then it is also divisible by 100, so we must place 0 in the last blank space. Dividing by 100 yields another square, which has the form 1_2_3_4_5_6_7_8_9.
We insert digits a, b, c, d into the first 4 blank spaces:
1a2b3c4d5_6_7_8_9
There is at most one way to fill in the remaining blanks to obtain a square, because the difference between two distinct 17-digit squares is at least $(10^8 + 1)^2 - (10^8)^2 = 2\times 10^8 + 1$, so the first nine digits cannot agree.
To find the candidate square root, we fill in the remaining blanks with 9s, compute the square root, and round down to the nearest integer.